package com.mystore.framework.pojo;

import java.io.Serializable;
import java.util.List;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import icu.mhb.mybatisplus.plugln.annotations.JoinField;
import icu.mhb.mybatisplus.plugln.constant.RelevancyType;
import lombok.Setter;
import lombok.Getter;
import org.springframework.cache.annotation.Cacheable;

/**
 * 应用表(App)实体类
 *
 * @author MyStore
 * @since 2023-06-28 14:04:57
 */

@Getter
@Setter
@Cacheable("app")
public class App implements Serializable {
    private static final long serialVersionUID = 205167146338967435L;
    /**
     * 应用ID
     */
    @TableId(type = IdType.AUTO)
    private Integer appId;
    /**
     * 应用名称
     */
    private String appName;
    /**
     * 应用描述
     */
    private String appDescription;
    /**
     * 应用图标
     */
    private String appIcon;
    /**
     * 应用截图
     */
    private String appImage;
    /**
     * 下载次数
     */
    private Long downloadCount;
    /**
     * app上线情况，0上架，1下架
     */
    private Integer appState;
    /**
     * app模型集合
     */
    @TableField(exist = false)
    @JoinField(masterModelClass = App.class, masterModelField = "appId",
            sunModelClass = AppModel.class, sunModelField = "appId", relevancyType = RelevancyType.MANY_TO_MANY,
            sunAlias = "t2")
    private List<AppModel> appModelList;
    public String[] getImages(){
        return appImage==null?null:appImage.split(",");
    }
}

